
Net hunter
|
Posted - 2005.08.03 11:16:00 -
[1]
Right. You trust CCP to have put in code for the odd occurance of a ship having negative speed 
Knowing most programmers negative speed will probably cause the ship to do 30Au/s 
If you're wanting to get geeky about it, when you start using 'standard' 32 bit integer mathematics the highest number one can have is 4,294,967,295. (Imagine 32 'bits' all set to 1, you have 1 + 2 + 4 + 6 + ... + 2,147,483,648)
However, there's a technique in binary numbers called '2s complement'. Basically, it's a way of taking something that's a 'positive' number and essentially using the most significant bit as a 'sign'. To convert a 'positive' number to a 2's complement negative, the rule is simple. Invert the bits, and add 1. (the add 1, is because -0 is meaningless, and you really don't want a sequence of numbers that goes 5,4,3,2,1,0,0,-1,-2,...)
What this means is that 2147483647 + 1 ( 011111111111111111111111111111111 + 1) 'wraps' to -2147483647.
However, it's _also_ 2147483648. (Depending on if it's defined as 'signed' or 'unsigned')
Where am I going with this? Well, it's entirely possible that 'speed' being meaningless to have a negative. Speed has no negative, it's a scalar quantity. Velocity, given it has a direction, has a vector quantity so that can be negative, or just not match speed. (e.g. consider orbiting a ship at 500m. Your speed is 1km/sec, but you're going 'wherever that other ship is'. So your velocity is approximately what theirs is.)
Anyhow, it's quite conceivable that -speed would end up as around 4billion m/sec. Since it'll 'subtract' 1 from 0, get 111111111111111111111111111111111 (33 1's) but the '33rd 1' will be truncated, so you'll have 2^32 - 1.
Briefly, as I suspect that because of the nature of byte overflows, strange things would start happening at that point, and the node would bomb.
Of course, it's entirely possible they _have_ simply considered 'negative speed' with a conditional like if speed < 0, speed = 0. Or more simply, have set speed up as a vector quantity, such that negative is flying backwards. It's a bit strange, but a lot less strange than 'boom, 14 times the speed of light'.
Or was that needlessly geeky?
OMG THAT WAS AMAZING!!!!!!!
|